package com.qidian.buy.cms.controller;

import com.qidian.buy.cms.service.IContentService;
import com.qidian.buy.entity.Content;
import com.qidian.buy.util.pojo.BuyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 戴着假发的程序员
 * @since 2023-07-05
 */
@RestController
@CrossOrigin
@RequestMapping("/buy/content")
public class ContentController {

    @Autowired
    private IContentService contentService;

    @PostMapping("/save")
    public BuyResult save(@RequestBody Content content){
        return  contentService.saveContent(content);
    };

    @GetMapping("/list")
    public BuyResult list(@RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "10")int limit,Long catId){
        return contentService.queryByCatId(page,limit,catId);
    };
}
